package com.nauu.atombuilder.figures;

import org.eclipse.draw2d.LabeledContainer;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;


public class ColbarFigure extends NodeFigure{
	
	public static final Dimension SIZE = new Dimension(300, 35);
	
    private LabeledContainer rectangleFigure;

    public ColbarFigure() {
//        this.rectangleFigure = new RectangleFigure();
        this.rectangleFigure = new LabeledContainer();
        rectangleFigure.setLayoutManager(new ToolbarLayout());
        rectangleFigure.setLabel("col");
        this.add(rectangleFigure);
    }

    public void setName(String name) {
        this.rectangleFigure.setLabel(name);
        this.repaint();
    }

    //------------------------------------------------------------------------
    // Overridden methods from Figure

    public void setBounds(Rectangle rect) {
        super.setBounds(rect);
        this.rectangleFigure.setBounds(rect);
    }

	@Override
	public Rectangle getTextBounds() {
		return this.rectangleFigure.getBounds();
	}


	public void translateToAbsolute(Dimension font) {
		this.rectangleFigure.translateToAbsolute(font);
	}

	@Override
	public void setBackgroundColor(Color color) {
		this.rectangleFigure.setBackgroundColor(color);
	}
	
	@Override
	public Dimension getPreferredSize(int wHint, int hHint) {
		return SIZE;
	}
	
}
